<script setup>
	import { sessionCode } from '@/common/user/index.js'
	import { useUserInfo } from '@/stores/userInfo.js'
	import { onLaunch } from '@dcloudio/uni-app'
	import {getCurrentInstance} from 'vue'
	const { proxy } = getCurrentInstance();
	const {$isResolve} = proxy
	const login = ()=>{
		return new Promise((resolve, reject) => {
			uni.login({
				provider: 'alipay',
				success: (res) => resolve(res),
				fail:(err) => reject(err)
			})
		})
	}
	const getMPinfo = async ( )=>{
		const result = await login();//获取登录token
		const data = await sessionCode(result.code);
		if(data.code == 0){
			useUserInfo().setOpenid(data.data.userId);
		}
		$isResolve()
	}
	const parseUrlParams = (url)=>{
		const vars = url.split('?');
		const vars1 = vars[1].split('&');
		const vars2 = vars1[0].split('=');
	
		return vars2[1];
		  
	}
	onLaunch((option) => {
		console.log(option)
		if(option.query && option.query.qrCode){
			const detailId = parseUrlParams(option.query.qrCode)
			console.log('detailID:'+detailId);
			uni.setStorageSync('qrSinceId',detailId);
		}
	    getMPinfo();		
	})
	
</script>

<style lang="scss">
	.apps{
		background-color: #ebf2f9;
		min-height: 100vh;
		color:#434343;
		font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, "Segoe UI", Arial "PingFang SC", "Microsoft Yahei", sans-serif;
	}
	input,textarea {outline: 0;flex: 1;}
	input {height: 100%;}
	.pmid {top: 50%;left: 50%;transform: translate(-50%, -50%);}
	/* 上 */
	.mt5 {margin-top: 5rpx;}
	.mt10 {margin-top: 10rpx;}
	.mt10p {margin-top: 10vh;}
	.mt15 {margin-top: 15rpx;}
	.mt20 {margin-top: 20rpx;}
	.mt20p {margin-top: 20vh;}
	.mt25 {margin-top: 25rpx;}
	.mt30 {margin-top: 30rpx;}
	.mt35 {margin-top: 35rpx;}
	.mt40 {margin-top: 40rpx;}
	.mt50 {margin-top: 50rpx;}
	.mt60 {margin-top: 60rpx;}
	.mt70 {margin-top: 70rpx;}
	.mt80 {margin-top: 80rpx;}
	.mt90 {margin-top: 90rpx;}
	/* 左 */
	.ml5 {margin-left: 5rpx;}
	.ml10 {margin-left: 10rpx;}
	.ml15 {margin-left: 15rpx;}
	.ml20 {margin-left: 20rpx;}
	.ml25 {margin-left: 25rpx;}
	.ml30 {margin-left: 30rpx;}
	.ml35 {margin-left: 35rpx;}
	.ml40 {margin-left: 40rpx;}
	/* 右 */
	.mr5 {margin-right: 5rpx;}
	.mr10 {margin-right: 10rpx;}
	.mr15 {margin-right: 15rpx;}
	.mr20 {margin-right: 20rpx;}
	.mr25 {margin-right: 25rpx;}
	.mr30 {margin-right: 30rpx;}
	.mr35 {margin-right: 35rpx;}
	.mr40 {margin-right: 40rpx;}
	/* 下 */
	.mb10 {margin-bottom: 10rpx;}
	.mb15 {margin-bottom: 15rpx;}
	.mb20 {margin-bottom: 20rpx;}
	.mb25 {margin-bottom: 25rpx;}
	.mb30 {margin-bottom: 30rpx;}
	.mb40 {margin-bottom: 40rpx;}
	.mb50 {margin-bottom: 50rpx;}
	.mb60 {margin-bottom: 60rpx;}
	.mb70 {margin-bottom: 70rpx;}
	.mb80 {margin-bottom: 80rpx;}
	.mb100 {margin-bottom: 100rpx;}
	.mb120 {margin-bottom: 120rpx;}
	.mb140 {margin-bottom: 140rpx;}
	.mb180 {margin-bottom: 180rpx;}
	/* 上下 */
	.mtb5 {margin-top: 5rpx;margin-bottom: 5rpx;}
	.mtb10 {margin-top: 10rpx;margin-bottom: 10rpx;}
	.mtb15 {margin-top: 15rpx;margin-bottom: 15rpx;}
	.mtb20 {margin-top: 20rpx;margin-bottom: 20rpx;}
	.mtb25 {margin-top: 25rpx;margin-bottom: 25rpx;}
	.mtb30 {margin-top: 30rpx;margin-bottom: 30rpx;}
	.mtb35 {margin-top: 35rpx;margin-bottom: 35rpx;}
	.mtb40 {margin-top: 40rpx;margin-bottom: 40rpx;}
	.mtb50 {margin-top: 50rpx;margin-bottom: 50rpx;}
	/* 左右 */
	.mlr5 {margin-left: 5rpx;margin-right: 5rpx;}
	.mlr10 {margin-left: 10rpx;margin-right: 10rpx;}
	.mlr15 {margin-left: 15rpx;margin-right: 15rpx;}
	.mlr20 {margin-left: 20rpx;margin-right: 20rpx;}
	.mlr25 {margin-left: 25rpx;margin-right: 25rpx;}
	.mlr30 {margin-left: 30rpx;margin-right: 30rpx;}
	.mlr35 {margin-left: 35rpx;margin-right: 35rpx;}
	.mlr40 {margin-left: 40rpx;margin-right: 40rpx;}
	.mlr50 {margin-left: 50rpx;margin-right: 50rpx;}
	.mlr60 {margin-left: 60rpx;margin-right: 60rpx;}
	/* 内边距 */
	/* 上 */
	.pt5 {padding-top: 5rpx;}
	.pt10 {padding-top: 10rpx;}
	.pt15 {padding-top: 15rpx;}
	.pt20 {padding-top: 20rpx;}
	.pt25 {padding-top: 25rpx;}
	.pt30 {padding-top: 30rpx;}
	.pt35 {padding-top: 35rpx;}
	.pt40 {padding-top: 40rpx;}
	.pt45 {padding-top: 45rpx;}
	.pt50 {padding-top: 50rpx;}
	.pt60 {padding-top: 60rpx;}
	/* 左 */
	.pl5 {padding-left: 5rpx;}
	.pl10 {padding-left: 10rpx;}
	.pl15 {padding-left: 15rpx;}
	.pl20 {padding-left: 20rpx;}
	.pl25 {padding-left: 25rpx;}
	.pl30 {padding-left: 30rpx;}
	.pl35 {padding-left: 35rpx;}
	.pl40 {padding-left: 40rpx;}
	.pl45 {padding-left: 45rpx;}
	.pl50 {padding-left: 50rpx;}
	/* 右 */
	.pr5 {padding-right: 5rpx;}
	.pr10 {padding-right: 10rpx;}
	.pr15 {padding-right: 15rpx;}
	.pr20 {padding-right: 20rpx;}
	.pr25 {padding-right: 25rpx;}
	/* 下 */
	.pb10 {padding-bottom: 10rpx;}
	.pb20 {padding-bottom: 20rpx;}
	.pb30 {padding-bottom: 30rpx;}
	.pb40 {padding-bottom: 40rpx;}
	.pb60 {padding-bottom: 60rpx;}
	/* 上下 */
	.ptb5 {padding-top: 5rpx;padding-bottom: 5rpx;}
	.ptb10 {padding-top: 10rpx;padding-bottom: 10rpx;}
	.ptb15 {padding-top: 15rpx;padding-bottom: 15rpx;}
	.ptb20 {padding-top: 20rpx;padding-bottom: 20rpx;}
	.ptb25 {padding-top: 25rpx;padding-bottom: 25rpx;}
	.ptb30 {padding-top: 30rpx;padding-bottom: 30rpx;}
	.ptb40 {padding-top: 40rpx;padding-bottom: 40rpx;}
	.ptb80 {padding-top: 80rpx;padding-bottom: 80rpx;}
	/* 左右 */
	.plr5 {padding-left: 5rpx;padding-right: 5rpx;}
	.plr10 {padding-left: 10rpx;padding-right: 10rpx;}
	.plr15 {padding-left: 15rpx;padding-right: 15rpx;}
	.plr20 {padding-left: 20rpx;padding-right: 20rpx;}
	.plr25 {padding-left: 25rpx;padding-right: 25rpx;}
	.plr30 {padding-left: 30rpx;padding-right: 30rpx;}
	.plr35 {padding-left: 35rpx;padding-right: 35rpx;}
	.plr40 {padding-left: 40rpx;padding-right: 40rpx;}
	.plr45 {padding-left: 45rpx;padding-right: 45rpx;}
	.plr50 {padding-left: 50rpx;padding-right: 50rpx;}
	.plr60 {padding-left: 60rpx;padding-right: 60rpx;}
	/* 对齐方式 */
	.tac {text-align: center;}
	.tal {text-align: left;}
	.tar {text-align: right;}
	.taj {text-align-last: justify;}
	/* 行高 */
	.lh40 {line-height: 40rpx;}
	.lh45 {line-height: 45rpx;}
	.lh50 {line-height: 50rpx;}
	.lh55 {line-height: 55rpx;}
	.lh60 {line-height: 60rpx;}
	.lh70 {line-height: 70rpx;}
	.ti2 {text-indent: 2em;}
	// 贯穿线
	.tdl {text-decoration: line-through;}
	// 下划线
	.tbu {text-decoration: underline;}
	/* 单行溢出隐藏显示... */
	.thd {overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
	/* 多行溢出隐藏显示... */
	.t2hd {overflow: hidden;text-overflow: -o-ellipsis-lastline;text-overflow: ellipsis;display: -webkit-box;/* 控制行数 */-webkit-line-clamp: 2;-webkit-box-orient: vertical;}
	.t3hd {overflow: hidden;text-overflow: -o-ellipsis-lastline;text-overflow: ellipsis;display: -webkit-box;/* 控制行数 */-webkit-line-clamp: 3;-webkit-box-orient: vertical;}
	.t4hd {overflow: hidden;text-overflow: -o-ellipsis-lastline;text-overflow: ellipsis;display: -webkit-box;/* 控制行数 */-webkit-line-clamp: 4;-webkit-box-orient: vertical;}
	/* 元素不换行 */
	.wsn {white-space: nowrap;}
	/* 文字大小 */
	.f12{font-size: 12px;}
	.f13{font-size: 13px;}
	.f14{font-size: 14px;}
	.f16 {font-size: 16px;}
	.f22r{font-size:22rpx;}
	.f24r{font-size:24rpx;}
	.f28r{font-size: 28rpx;}
	.f30r{font-size:30rpx;}
	.f36r{font-size:36rpx;}
	.b {font-weight: bold;}
	/* 边框 */
	.bd1s {border: 1rpx solid;}
	.bdl1s {border-left: 1rpx solid;}
	.bdl1s {border-left: 1rpx solid }
	.bdt1s {border-top: 1rpx solid }
	.bdb1s {border-bottom: 1rpx solid;}
	.bdb1d {border-bottom: 1rpx dashed;}
	.bcccc {border-color: #ccc;}
	.bceee {border-color: #eee;}
	
	/* 多行文本框 */
	.txtplus {box-sizing: border-box !important;width: 100%;}
	
	.w100p{width:100%}
	
	/* 弹性盒模型 */
	.flex {display: flex;}
	.fdr{flex-direction: row;}
	.fdc {flex-direction: column}
	.jcsa {justify-content: space-around !important;}
	.jcsb {justify-content: space-between !important;}
	.jcc {justify-content: center !important;}
	.jcl {justify-content: flex-start !important;}
	.jcr {justify-content: flex-end !important;}
	.aic {align-items: center !important;}
	.aib {align-items: baseline !important;}
	.ail {align-items: flex-start !important;}
	.air {align-items: flex-end !important;}
	.ais {align-items: stretch !important;}
	.fww {flex-wrap: wrap;}
	.f1{flex:1;}
	.w100{width:100rpx;}
	/* 单行溢出隐藏显示... */
	.thd {overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
	/* 多行溢出隐藏显示... */
	.t2hd {overflow: hidden;text-overflow: -o-ellipsis-lastline;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;}
	.t4hd {overflow: hidden;text-overflow: -o-ellipsis-lastline;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 4;-webkit-box-orient: vertical;}
	/* 圆角 */
	.br4 {border-radius: 4rpx;}
	.cir {border-radius: 50%;}
	.bar {border-radius: 100rpx;}
	.br10 {border-radius: 10rpx;}
	.br15 {border-radius: 15rpx;}
	.br20 {border-radius: 20rpx;}
	.br30 {border-radius: 30rpx;}
	.cir {border-radius: 50%;}
	.ft18{font-size: 18px;}
	.ft20{font-size: 20px;}
	.ftita{font-style: italic;}
	.fweight4{ font-weight: 400;}
	.fweight6{ font-weight: 600;}
	.mt20{margin-top: 20rpx;}
	.mt30{margin-top: 30rpx;}
	.mb20{margin-bottom: 20rpx;}
	.mr20{margin-right:20rpx;}
	.mtb10{margin-top:10rpx; margin-bottom:10rpx;}
	.mlr10{margin-left:10rpx; margin-right:10rpx;}
	.mtb20{margin-top:20rpx; margin-bottom:20rpx;}
	.mlr20{margin-left:20rpx; margin-right:20rpx;}
	.pd20{padding:20rpx;}
	.pd30{padding:30rpx;}
	.pdb20{padding-bottom:20rpx;}
	.pdtb10{padding-top: 10rpx; padding-bottom: 10rpx;}
	.pdlr10{padding-left: 10rpx; padding-right: 10rpx;}
	.pdtb15{padding-top: 15rpx; padding-bottom: 15rpx;}
	.pdlr15{padding-left: 15rpx; padding-right: 15rpx;}
	.pdtb20{padding-top: 20rpx; padding-bottom: 20rpx;}
	.pdlr20{padding-left: 20rpx; padding-right: 20rpx;}
	.pdtb30{padding-top: 30rpx; padding-bottom: 30rpx;}
	.bgwhite{background-color: white;}
	
	.blue{color:#005fea;}
	.red{color:#a82022;}
	.black{color:#111;}
	.white{color:#fff}
	.nolist{padding-top: 450rpx;}
	.zindex-1{z-index: 10;}
	.zindex-2{z-index: 100;}
	.c666{color:#666;}
	.c888{color:#888;}
	.box{box-sizing: border-box;}
</style>
